﻿//Created by Action Script Viewer - http://www.buraks.com/asv
package net.wooga.pets.controllers {
    import net.wooga.pets.events.*;
    import net.wooga.pets.models.vo.*;
    import net.wooga.pets.models.*;
    import net.wooga.pets.views.components.mainmenu.*;
    import net.wooga.pets.constants.*;
    import org.robotlegs.mvcs.*;
    import net.wooga.pets.models.world.*;

    public class ShopTabOpenCommand extends Command {

        public var event:InfoEvent;
        public var shopModel:ShopModel;
        public var worldModel:WorldModel;
        public var roomSlotsModel:RoomSlotsModel;
        public var gameStateModel:GameStateModel;

        override public function execute():void{
            var _local1:String = this.event.id;
            if ((((_local1 == ShopMenu.TAB_ROOMS)) && (this.gameStateModel.initWorldComplete))){
                this.checkBuildRooms();
            };
        }
        private function checkBuildRooms():void{
            var _local2:Array;
            var _local3:String;
            var _local1:Array = this.shopModel.getItemsByCategory(ShopItemVO.CATEGORY_ROOMS);
            for each (_local3 in _local1) {
                _local2 = ((this.worldModel.getRoomIdsOfType(_local3)) || ([]));
                if ((((_local2.length == 0)) && (this.roomSlotsModel.isSlotAvailable()))){
                    dispatch(new InfoEvent(EventConstants.PLAY_HIGHTLIGHT_ITEM_ANIMATION, _local3));
                };
            };
        }

    }
}//package net.wooga.pets.controllers 
